summaryrefslogtreecommitdiff
path: root/src/pages/blog/[...slug].astro
diff options
context:
space:
mode:
authorJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2024-03-30 16:32:17 +0000
committerJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2024-03-30 16:43:22 +0000
commit261d89ebed13691e72312f44339063fee93130ac (patch)
tree43cb6f1a9804352f666efaaee2bf7d6189906f08 /src/pages/blog/[...slug].astro
parent9cb047768f79f3d14a5c6bcf420e76d600a20f2d (diff)
Astro initial commit
Diffstat (limited to 'src/pages/blog/[...slug].astro')
-rw-r--r--src/pages/blog/[...slug].astro20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro
new file mode 100644
index 0000000..800c534
--- /dev/null
+++ b/src/pages/blog/[...slug].astro
@@ -0,0 +1,20 @@
+---
+import { type CollectionEntry, getCollection } from 'astro:content';
+import BlogPost from '../../layouts/BlogPost.astro';
+
+export async function getStaticPaths() {
+ const posts = await getCollection('blog');
+ return posts.map((post) => ({
+ params: { slug: post.slug },
+ props: post,
+ }));
+}
+type Props = CollectionEntry<'blog'>;
+
+const post = Astro.props;
+const { Content } = await post.render();
+---
+
+<BlogPost {...post.data}>
+ <Content />
+</BlogPost> \ No newline at end of file